
import base64
from Crypto.Cipher import AES
from Crypto.Util.Padding import unpad
import requests
import hashlib
import random
import time

def decrypt(data):
    html = base64.b64decode(data)
    key = b'xc46VoB49X3PGYAg'
    aes = AES.new(key=key, mode=AES.MODE_ECB)
    info = aes.decrypt(html)
    decrypt_data = unpad(info, 16).decode()
    return decrypt_data


def webid():
    def md5(data):
        return hashlib.md5(data.encode()).hexdigest()
    def a_m(t=6, e=None, n='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'):
        if e is not None and isinstance(e, str):
            n = e
        r = e if e and isinstance(e, int) else t
        o = ""
        for _ in range(r):
            a = random.randint(0, len(n) - 1)
            o += n[a]
        return o
    def z_i():
        t = None
        user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36'
        e = (t or user_agent or a_m(4, 8)) + str(time.time()) + a_m(4, 8)
        return 'X/' + md5(e)
    # 测试函数
    return z_i()


h = {
    "accept": "application/json, text/plain, */*",
    "content-type": "application/json;charset=UTF-8",
    "origin": "https://www.qizhidao.com",
    "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36",
    "user-agent-web": webid(),
}

print(webid())
